package com.junit.test.spring.ioc;

import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.janwen.spring.ioc.SpringIOCInjectBean;


public class SpringIOCTestUnit {

	BeanFactory beanFactory = null;
			
	static final Logger logger = Logger.getLogger(SpringIOCTestUnit.class);
	@Before	
    public void init(){
		ApplicationContext appcontext = new ClassPathXmlApplicationContext("applicationContext.xml");
		beanFactory = appcontext;
	}
	@Test
	public void test() {
		SpringIOCInjectBean bean = (SpringIOCInjectBean)beanFactory.getBean("springioc");
		logger.info(bean.get_name());
	}

}
